
<style>
.CLOSED
{
	background-color:red;
}

</style>
<SCRIPT LANGUAGE=javascript>

jQuery(function($){

$.datepicker.regional['ru'] = {
		clearText: 'Очистить', clearStatus: '',
		closeText: 'Закрыть', closeStatus: '',
		prevText: '&#x3c;Пред',  prevStatus: '',
		prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
		nextText: 'След&#x3e;', nextStatus: '',
		nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
		currentText: 'Сегодня', currentStatus: '',
		monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
		'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
		monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
		'Июл','Авг','Сен','Окт','Ноя','Дек'],
		monthStatus: '', yearStatus: '',
		weekHeader: 'Не', weekStatus: '',
		dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
		dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
		dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
		dayStatus: 'DD', dateStatus: 'D, M d',
		dateFormat: 'yy-mm-dd', firstDay: 3,
		initStatus: '', isRTL: false,
		showMonthAfterYear: false, yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['ru']);
});


var scheduledDays = [[10, 1, 2010, 'PEND'], [12, 3, 2008, 'PEND'], [12, 4, 2008, 'PEND']];
var holidayDays = [];

function setScheduledDays(date) {
    var isScheduled = false;
    var isHoliday = false;
    var scheduleStatus = "";

    // Check for scheduled day

    for (i = 0; i < scheduledDays.length; i++) {
      if (date.getMonth() == scheduledDays[i][0] - 1 && date.getDate() == scheduledDays[i][1] && date.getFullYear() == scheduledDays[i][2])
      {
        isScheduled = true;
        scheduleStatus = scheduledDays[i][3];
      }
    }

    // Check for holidays
    if (holidayDays != null)
    {
        for (i = 0; i < holidayDays.length; i++) {
          if (date.getMonth() == holidayDays[i][0] - 1 && date.getDate() == holidayDays[i][1] && date.getFullYear() == holidayDays[i][2])
          {
            isHoliday = true;
          }
        }
    }   

    if (isHoliday)
        return [false, 'CLOSED'];
    else if (isScheduled)
        return [true, scheduleStatus];
    else
      return [true, ''];
} 
</SCRIPT>

<SCRIPT LANGUAGE=javascript>
<!--
var activeDate = new Date('<?php echo date("m/d/Y")?>');
$(document).ready(function()
{
	Assign();
 });



function process(datos) { 
	holidayDays = datos;
	$( "#datepicker_div" ).datepicker( "destroy" );
	$( "#datepicker_div" ).datepicker({numberOfMonths: 3,showButtonPanel: true,beforeShowDay: setScheduledDays});
	};

function Assign()
{
	var id=$("#type").attr("value");
	$("#room_name").html(id);
	$.getJSON(url("book/get-dates"),{type:id},process,process);
	$('#type').change(Assign);
	$("#from").datepicker({ firstDay: 1, showStatus:true,yearRange: '2010:2011',defaultDate: activeDate,firstDay: 0,inline: true,showOtherMonths: true,beforeShowDay: setScheduledDays});
	$("#till").datepicker({ firstDay: 0, showStatus:true,yearRange: '2010:2011',defaultDate: activeDate,firstDay: 0,inline: true,showOtherMonths: true,beforeShowDay: setScheduledDays,});
}




function openOrder(id)
{
	window.location.href=url("book/process/id/"+id);
	return false;
}
//-->
</SCRIPT>

<script>
	$(function() {
		
	});
	</script>



<div style="float: right;">
	<a href="<?php echo $this->l("book/manual")?>">Ручное бронирование</a>
	

</div>
<h2>Список заказов</h2>

<style>
<!--
table {
border:1px solid #B7C8DE;
border-collapse:collapse;


width:100%;
}
table th, table td {
border-bottom:1px solid #D3DEEB;
border-right:1px solid #D3DEEB;
padding:5px 6px;
vertical-align:middle;
}
table th {
background-image:url("<?php echo $this->l("stuff/images/th-bg.png")?>");
border:1px solid #B7C8DE;
color:#0B55C4;
text-align:center;
}

-->
</style>
<table width="100%">
<tr>
<th>Тип</th>
<th>Заезд</th>
<th>Выезд</th>
</tr>
<?php 
foreach ($this->Rows as $Item)
{
    
    $Color = ($Item['approved']==0)?"white":(($Item['approved']==1)?"#38ACEC":"#F778A1");
    
?>	
<tr  onmouseover="$(this).css('background-color','#F8F8FF')" style="background-color: <?=$Color;?>;cursor: pointer;" onmouseout="$(this).css('background-color','<?=$Color;?>')"  onclick="openOrder(<?=$Item['id'] ?>);" style="cursor: pointer;"  >
<td><?=$Item['room'] ?></td>
<td><?=$Item['from'] ?></td>
<td><?=$Item['till'] ?></td>
</tr>
<?php 
}
?>
</table>

